import LayoutWhite from "@/components/LayoutWhite";
import Title from "@/components/Title";
import { useTabsContext } from "@/contexts/TabsContext";
import EditOr from "./components/edit";
import { useEffect, useState } from "react";
import { detWordList } from "@/api/modules/word";
import { useSearchParams } from "react-router-dom";

const shopCar = () => {
	const { delTabs } = useTabsContext();
	const [data, setData] = useState<any>({});
	const [searchParams] = useSearchParams();
	console.log(delTabs);

	useEffect(() => {
		detWordList(searchParams.get("id")).then((res: any) => {
			setData(res.data.data);
		});
	}, []);

	return (
		<LayoutWhite>
			<Title word="文章详情"></Title>
			<p style={{ width: "700px", fontSize: "24px", margin: "0 auto" }}>{data?.title}</p>
			<p style={{ width: "700px", fontSize: "16px", margin: "0 auto", color: "rgb(178,178,178)" }}>{data?.createdAt}</p>
			<EditOr
				defaultHtml={data?.description}
				updateHtml={(e: any) => {
					console.log(e);
				}}
				is={true}
			/>
		</LayoutWhite>
	);
};

export default shopCar;
